@rem 生成服务端公钥、私钥和证书仓库
keytool -genkey -alias server -keysize 2048 -keyalg RSA -validity 365 -keystore serverStore.jks -storepass nettyDemo -dname "CN=localhost"
@rem 导出服务端签名证书证书
keytool -export -alias server -keystore serverStore.jks -storepass nettyDemo -file server.cer
@rem 生成netty客户端公钥、私钥和证书仓库
keytool -genkey -alias client -keysize 2048 -keyalg RSA -validity 365 -keystore clientStore.jks -storepass nettyDemo -dname "CN=localhost"
@rem 将服务端证书导入到客户端证书仓库
keytool -import -trustcacerts -alias server -file server.cer -storepass nettyDemo -keystore clientStore.jks
@rem 导出客户端自签名证书
keytool -export -alias client -keystore clientStore.jks -storepass nettyDemo -file client.cer
@rem 将客户端证书导入到服务端证书仓库
keytool -import -trustcacerts -alias client -file client.cer -storepass nettyDemo -keystore serverStore.jks

